package com.jackiechan.hello.day01;

import java.util.Scanner;

/**
 * 要求用户从控制台输入一个email地址，然后获取该email的用户名(@之前的内容)
 * @author Xiloer
 *
 */
public class Test04 {
	public static void main(String[] args) {
		System.out.print("请输入你的email:");
		String email = new Scanner(System.in).nextLine();
		StringBuilder sb = new StringBuilder(email);
		int index = sb.indexOf("@");
		System.out.println(sb.substring(0,index));
		System.out.println("***************");
		getUserName();
	}

	private static void getUserName() {
		System.out.print("请输入您的email：");
		String email = new Scanner(System.in).nextLine();
		StringBuilder sb = new StringBuilder(email);
		int index = sb.indexOf("@");
		System.out.println(sb.substring(0,index));
	}
}
